﻿<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="UsingList.aspx.cs" Inherits="Inventory_UsingList" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
 <fieldset style="margin: 10px 10px 10px 10px; padding: 5px 5px 5px 5px;">
        <legend>搜索条件</legend>地区：
        <asp:DropDownList ID="ddlRegion" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource2" DataTextField="RegionName" DataValueField="RegionID">
        </asp:DropDownList>
        餐厅：
        <asp:DropDownList ID="ddlStore" runat="server" DataSourceID="ObjectDataSource1" DataTextField="StoreName" DataValueField="StoreID">
        </asp:DropDownList>
        用量日期：
        <asp:TextBox ID="txtBeginDate" runat="server"></asp:TextBox>
        <asp:RangeValidator ID="RangeValidator1" runat="server" Display="Dynamic" ErrorMessage="*必须为2000-1-1至2100-1-1"
            ControlToValidate="txtBeginDate" MaximumValue="2100-1-1" MinimumValue="2000-1-1"
            SetFocusOnError="True" Type="Date"></asp:RangeValidator>至：<asp:TextBox ID="txtEndDate"
                runat="server"></asp:TextBox>
        <asp:RangeValidator ID="RangeValidator2" runat="server" Display="Dynamic" ErrorMessage="*必须为2000-1-1至2100-1-1"
            ControlToValidate="txtEndDate" MaximumValue="2100-1-1" MinimumValue="2000-1-1"
            SetFocusOnError="True" Type="Date"></asp:RangeValidator>
         用量类型：
        <asp:DropDownList ID="ddlUsingType" runat="server" DataSourceID="ObjectDataSource3">
        </asp:DropDownList>
        <asp:Button ID="btnQuery" Text="查询" runat="server" />
    </fieldset>
    <fieldset style="margin: 10px 10px 10px 10px; padding: 5px 5px 5px 5px;">
    <asp:GridView ID="GridView1" runat="server" BorderWidth="1px" EmptyDataText="找不到批配的数据"
        HorizontalAlign="Center" Width="100%" AutoGenerateColumns="False"  AllowPaging="True" DataSourceID="ObjectDataSource4">
        <EmptyDataRowStyle BackColor="#0000C0" Font-Bold="True" Font-Size="12pt" />
        <HeaderStyle BackColor="Gray" />
        <AlternatingRowStyle BackColor="#E0E0E0" />
        <EditRowStyle ForeColor="White" />
        <Columns>
            <asp:BoundField DataField="StoreID" HeaderText="餐厅编号" SortExpression="StoreID" />
            <asp:BoundField DataField="StoreName" HeaderText="餐厅名称" SortExpression="StoreName" />
            <asp:BoundField DataField="ClosingStocktakingDate" HeaderText="用量日期" SortExpression="ClosingStocktakingDate" />
            <asp:BoundField DataField="UsingType" HeaderText="用量类型" SortExpression="UsingType" />
            <asp:BoundField DataField="MaterialID" HeaderText="物料编号" SortExpression="MaterialID" />
            <asp:BoundField DataField="MaterialName" HeaderText="物料名称" SortExpression="MaterialName" />
            <asp:BoundField DataField="OrderUnit" HeaderText="订货单位" SortExpression="OrderUnit" />
            <asp:BoundField DataField="Spec" HeaderText="规格" SortExpression="Spec" />
            <asp:BoundField DataField="Qty" HeaderText="用量" SortExpression="Qty" />
        </Columns>
    </asp:GridView>
    </fieldset>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetStoresByRegionID"
        TypeName="BaseInfoDB">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlRegion" Name="RegionID" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetRegionsExceptHQ"
        TypeName="BaseInfoDB"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="getDistinctUsingType"
        TypeName="Inventory">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" SelectMethod="getMaterialUsingsByCondition"
        TypeName="Inventory">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlRegion" Name="RegionID" PropertyName="SelectedValue"
                Type="Int32" />
            <asp:ControlParameter ControlID="ddlStore" Name="StoreID" PropertyName="SelectedValue"
                Type="String" />
            <asp:ControlParameter ControlID="txtBeginDate" Name="beginUsingDate" PropertyName="Text"
                Type="DateTime" />
            <asp:ControlParameter ControlID="txtEndDate" Name="endUsingDate" PropertyName="Text"
                Type="DateTime" />
            <asp:ControlParameter ControlID="ddlUsingType" Name="type" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>

